Demo thyself
authorMatthias Clasen <mclasen@redhat.com>
Sun, 13 Sep 2020 21:37:05 +0000 (17:37 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 13 Sep 2020 21:54:58 +0000 (17:54 -0400)
Make gtk-demo show itself as a useful example.

demos/gtk-demo/demo.gresource.xml
demos/gtk-demo/main.c

index 238503c0d287296255a35acdcc54486cff436296..08b90b677a0825051362d080185fa88f7355308d 100644 (file)
     <file compressed="true">color.names.txt</file>
     <file>listview_colors.css</file>
   </gresource>
+  <gresource prefix="/main">
+    <file>fontify.c</file>
+    <file>fontify.h</file>
+    <file>main.ui</file>
+  </gresource>
   <gresource prefix="/shortcuts">
     <file>shortcuts.ui</file>
     <file>shortcuts-builder.ui</file>
     <file>listview_weather.c</file>
     <file>listview_words.c</file>
     <file>list_store.c</file>
+    <file>main.c</file>
     <file>markup.c</file>
     <file>overlay.c</file>
     <file>overlay2.c</file>
index 40789d773eee78bd6dd633dac91288ed4ebc5243..5d21de899a7fa24602cc46eec274437ad621a588 100644 (file)
@@ -1,3 +1,17 @@
+/* GTK Demo
+ *
+ * GTK Demo is a collection of useful examples to demonstrate
+ * GTK widgets and features. It is a useful example in itself.
+ *
+ * You can select examples in the sidebar or search for them by
+ * typing a search term. Double-clicking or hitting the “Run” button
+ * will run the demo. The source code and other resources used in the
+ * demo are shown in this area.
+ *
+ * You can also use the GTK Inspector, available from the menu on the
+ * top right, to poke at the running demos, and see how they are put
+ * together.
+ */
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -798,10 +812,20 @@ create_demo_model (void)
 {
   GListStore *store = g_list_store_new (GTK_TYPE_DEMO);
   DemoData *demo = gtk_demos;
+  GtkDemo *d;
+
+  d = GTK_DEMO (g_object_new (GTK_TYPE_DEMO, NULL));
+  d->name = "main";
+  d->title = "GTK Demo";
+  d->keywords = NULL;
+  d->filename = "main.c";
+  d->func = NULL;
+
+  g_list_store_append (store, d);
 
   while (demo->title)
     {
-      GtkDemo *d = GTK_DEMO (g_object_new (GTK_TYPE_DEMO, NULL));
+      d = GTK_DEMO (g_object_new (GTK_TYPE_DEMO, NULL));
       DemoData *children = demo->children;
 
       d->name = demo->name;